var $RegExp = /.*/.constructor;
if (typeof(ScriptEngineMajorVersion) == "function" && ScriptEngineMajorVersion() == 5)
{	//for ie 5.x
	function RegExp(exp, flag)
	{
		var reg, oName;
		if (exp instanceof $RegExp)
		{
			var source = exp.toString()
				, p = source.lastIndexOf("/");
			reg = new $RegExp(source.substring(1, p), source.substr(p + 1));
		}
		else
		{
			flag = flag || "";
			exp = exp.replace(/\(\?[:=!]/g, "(");

			if (flag.length > (flag = flag.replace(/m/g, "")).length)
			{
				exp = exp.replace(/\$/g, "(\r\n|\n\r|\r|\n)")
			}
			reg = new $RegExp(exp, flag);
		}

		for (oName in RegExp.prototype)
		{
			reg[oName] = RegExp.prototype[oName];
		}
		return reg;
	}
	RegExp.prototype.exec = function(input)
	{
		if (this.input != input)
		{
			this.input = input;
			this.matchs = input.match(this);
			//alert(input+"\n"+this.matchs+"\n"+this.source)
			this.i = 0;
			this.p = 0;
		}

		if (this.matchs == null || this.i >= this.matchs.length)
		{
			return null
		}
		var m = this.matchs[this.i++]
			, r = [m];
		this.p = input.indexOf(m, this.p);

		r.index = this.p;
		this.p += m.length;
		r.lastIndex = this.p;
		return r;
	}
}
else if (/KHTML\/[123]\./.test(navigator.userAgent))
{	
	function RegExp(exp,flag){
	  if(exp instanceof $RegExp){
		var source = exp.toString()
			, p = source.lastIndexOf("/");
		return new $RegExp(source.substring(1,p),source.substr(p+1));
	  }else{
		return new $RegExp(exp,flag);
	  }
	}
}